// 员工相关接口
import request from '@/utils/request'

// 员工 -> 获取员工简单列表
export const getStaffEasylist = () =>
  request({
    url: '/sys/user/simple'
  })

// 员工 -> 获取员工详细列表
export const getHrTable = (params) =>
  request({
    url: '/sys/user',
    params
  })

// 员工 -> 根据id删员工
export const delEmployee = (id) =>
  request({
    url: `/sys/user/${id}`,
    method: 'DELETE'
  })

// 员工 -> 新增员工
export const addStaff = (data) =>
  request({
    url: '/sys/user',
    method: 'POST',
    data
  })

// 员工 -> 批量导入员工信息(excel)
export const ImportEmployees = data => request({
  url: '/sys/user/batch',
  method: 'POST',
  data
})

// 员工 -> 保存员工基本信息
export const setEmployeeInformation = data => request({
  url: `/sys/user/${data.id}`,
  method: 'PUT',
  data
})

// 员工 -> 获取员工基本信息
export const userInFormation = id => request({
  url: `/sys/user/${id}`
})

// 员工 -> 获取员工详细信息
export const getStaffDetailedInfo = id => request({
  url: `/employees/${id}/personalInfo`
})

// 员工 -> 保存员工详细信息
export const undataStaffDetailedInfo = data => request({
  url: `/employees/${data.id || data}/personalInfo`,
  method: 'PUT',
  data
})

// 员工 -> 获取员工岗位信息
export const getPostInformation = (id) => request({
  url: `/employees/${id}/jobs`
})

// 员工 -> 根据id分配角色
export const updateUserRole = data => request({
  url: '/sys/user/assignRoles',
  method: 'PUT',
  data
})
